package com.neutech.neupha.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.neutech.neupha.mapper.DrugsMapper;
import com.neutech.neupha.service.DrugsService;
import com.neutech.neupha.vo.DrugsVo;
import com.neutech.neupha.vo.ToAddDrugsVo;
import com.neutech.po.ConstantItem;

@Service
public class DrugsServiceImpl implements DrugsService{
	@Autowired
	private DrugsMapper drugsMapper;
	@Override
	public List<DrugsVo> queryAllDrugs() {
		// TODO Auto-generated method stub
		return drugsMapper.queryAllDrugs();
	}

	@Override
	public List<DrugsVo> queryDrugs(String name) {
		// TODO Auto-generated method stub
		return drugsMapper.queryDrugs(name);
	}

	@Override
	public int addDrugs(DrugsVo drugs) {
		// TODO Auto-generated method stub
		int num = drugsMapper.addDrugs(drugs);
		return num;
	}

	@Override
	public ToAddDrugsVo toAddDrugs() {
		// TODO Auto-generated method stub
		List<ConstantItem> drugsDosages = drugsMapper.toAddDrugs_DrugsDosage();
		List<ConstantItem> drugsTypes = drugsMapper.toAddDrugs_DrugsType();
		ToAddDrugsVo toAddDrugs = new ToAddDrugsVo();
		toAddDrugs.setDrugsDosages(drugsDosages);
		toAddDrugs.setDrugsTypes(drugsTypes);
		return toAddDrugs;
	}

	@Override
	public int updateDrugs(DrugsVo drugs) {
		// TODO Auto-generated method stub
		int num = drugsMapper.updateDrugs(drugs);
		return num;
	}

	@Override
	public ToAddDrugsVo toupdateDrugs() {
		// TODO Auto-generated method stub
		List<ConstantItem> drugsDosages = drugsMapper.toAddDrugs_DrugsDosage();
		List<ConstantItem> drugsTypes = drugsMapper.toAddDrugs_DrugsType();
		ToAddDrugsVo toAddDrugs = new ToAddDrugsVo();
		toAddDrugs.setDrugsDosages(drugsDosages);
		toAddDrugs.setDrugsTypes(drugsTypes);
		return toAddDrugs;
	}

	@Override
	public int delDrugs(int id) {
		// TODO Auto-generated method stub
		int num = drugsMapper.delDrugs(id);
		return num;
	}
	
}
